package MainUI;

import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.geometry.Insets;
import javafx.geometry.Orientation;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.control.*;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.input.MouseButton;
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.*;
import javafx.scene.text.Text;
import javafx.stage.Stage;
import linker.rightkey;
import slidePlay.PlayList;
import slidePlay.ViewImageStage;

import java.io.File;
import java.io.FileNotFoundException;
import java.text.SimpleDateFormat;
import java.util.*;

public class PreviewInterfaceUI {
    private File imagePath = new File("image");
    private static PlayList playList = new PlayList();
    //图片数量统计
    private static int numOfImage = 0;
    //图片总大小统计
    private static double sizeOfImage = 0;
    //定义预览界面的流面板
    private static FlowPane flowPane = new FlowPane(5, 5);
    //预览界面整体架构定义
    private static List<File> arrayListImageFile = new ArrayList<>();
    private static List<VBox> arrayListVbox = new ArrayList<>();
    private static Image image;
    private static Label labelName;
    private static ImageView imageView;
    private static VBox vBox;
    //鼠标点击数标记数组
    private static List<Integer> flag = new ArrayList<>();
    //当前选中的图片数量
    private static int choicePictureNum = 0;
    //当前选中的图片文件
    private static List<File> arrayListImageFileChoice = new ArrayList<>();
    //多选模式下选中的节点下标的记录数组
    private static List<Integer> arrayListPointed = new ArrayList<>();
    //判定是否进入多选模式，默认单选、同时判定是否进入快捷键模式
    private static boolean isMultipleChoice = false;
    //判定此右键单击是否需要清空多选后选中的图片，默认为真
    private static boolean isMultipleChoiceEnding = true;
    //右键菜单
    protected static ContextMenu contextMenu = new ContextMenu();
    private static MenuItem[] menuItems = new MenuItem[8];
    //粘贴操作用的缓冲区列表
    public static List<rightkey> bufferFiles = new ArrayList<>();
    //重命名控件
    private static String newName;
    private static String lastName;
    private static String[] listFileNames;
    private static List<String> fileAffixs = new ArrayList<>();
    private static TextField inputSerialNumber = new TextField();
    private static TextField inputDigitsNumber = new TextField();
    private static Label exhibitionLabel = new Label();
    private static TextField inputNewFileName = new TextField();
    private static Button confirmNewFileName = new Button();
    private static Button retype = new Button();
    private static Button exitRename = new Button();
    //删除确认界面
    public static Button confirmDelete = new Button();
    public static Button cancelDelete = new Button();
    //主界面
    private ScrollPane scrollPane = new ScrollPane(flowPane);
    private static BorderPane interfaceUI = new BorderPane();
    private static boolean firstTime = true;
    //控制栏界面控件
    //存放器
    HBox storer1 = new HBox(10);
    HBox storer2 = new HBox(10);
    //播放键
    private Image imageSlidePicture = new Image("file:" + imagePath.getAbsolutePath() + "/SlidePicture.png");
    private ImageView imageViewSlidePicture = new ImageView(imageSlidePicture);
    private Label labelSlidePicture = new Label();
    //上一张
    private Image imageLastPicture = new Image("file:" + imagePath.getAbsolutePath() + "/last.png");
    private ImageView imageViewLastPicture = new ImageView(imageLastPicture);
    private Label labelLastPicture = new Label();
    //下一张
    private Image imageNextPicture = new Image("file:" + imagePath.getAbsolutePath() + "/next.png");
    private ImageView imageViewNextPicture = new ImageView(imageNextPicture);
    private Label labelNextPicture = new Label();
    //剪切键
    private Image imageShearPicture = new Image("file:" + imagePath.getAbsolutePath() + "/shear.png");
    private ImageView imageViewShearPicture = new ImageView(imageShearPicture);
    private Label labelShearPicture = new Label();
    //复制键
    private Image imageCopyPicture = new Image("file:" + imagePath.getAbsolutePath() + "/copy.png");
    private ImageView imageViewCopyPicture = new ImageView(imageCopyPicture);
    private Label labelCopyPicture = new Label();
    //粘贴键
    private Image imagePastePicture = new Image("file:" + imagePath.getAbsolutePath() + "/paste.png");
    private ImageView imageViewPastePicture = new ImageView(imagePastePicture);
    private Label labelPastePicture = new Label();
    //刷新键
    private Image imageRefreshPicture = new Image("file:" + imagePath.getAbsolutePath() + "/refresh.png");
    private ImageView imageViewRefreshPicture = new ImageView(imageRefreshPicture);
    private Label labelRefreshPicture = new Label();
    //全选键
    private Image imageAllselectPicture = new Image("file:" + imagePath.getAbsolutePath() + "/allselect.png");
    private ImageView imageViewAllselectPicture = new ImageView(imageAllselectPicture);
    private Label labelAllselectsPicture = new Label();
    //删除键
    private Image imageDeletePicture = new Image("file:" + imagePath.getAbsolutePath() + "/delete.png");
    private ImageView imageViewDeletePicture = new ImageView(imageDeletePicture);
    private Label labelDeletePicture = new Label();
    //重命名键
    private Image imageRenamePicture = new Image("file:" + imagePath.getAbsolutePath() + "/rename.png");
    private ImageView imageViewRenamePicture = new ImageView(imageRenamePicture);
    private Label labelRenamePicture = new Label();
    //退出程序键
    private Image imageExitPicture = new Image("file:" + imagePath.getAbsolutePath() + "/exit.png");
    private ImageView imageViewExitPicture = new ImageView(imageExitPicture);
    private Label labelExitPicture = new Label();
    //信息操作栏
    private BorderPane controlLowerColumn = new BorderPane();
    //当前选中的图片的下标
    private static int choosePosition = 0;//默认为0，第一张


    //初始化预览视图
    public PreviewInterfaceUI() {
        //设置右键菜单栏
        menuItems[0] = new MenuItem("打开");
        menuItems[1] = new MenuItem("刷新           F5");
        menuItems[2] = new MenuItem("剪切       Ctrl+X");
        menuItems[3] = new MenuItem("复制       Ctrl+C");
        menuItems[4] = new MenuItem("粘贴       Ctrl+V");
        menuItems[5] = new MenuItem("删除       Ctrl+D");
        menuItems[6] = new MenuItem("重命名");
        menuItems[7] = new MenuItem("全选       Ctrl+A");
        contextMenu.getItems().addAll(menuItems);
        //建立预览界面面板
        //预览流板
        flowPane.setPadding(new Insets(10, 20, 20, 30));
        flowPane.setOrientation(Orientation.HORIZONTAL);
        flowPane.setHgap(20);
        flowPane.setVgap(30);
        flowPane.setStyle("-fx-background-color: white");
        flowPane.setPrefSize(560, 600);
        TopRoadUI topRoadUI = new TopRoadUI();
        interfaceUI.setTop(topRoadUI.getRoadBorderPane());

        //悬停框
        Tooltip.install(labelAllselectsPicture, new Tooltip("全选"));
        Tooltip.install(labelCopyPicture, new Tooltip("复制"));
        Tooltip.install(labelDeletePicture, new Tooltip("删除"));
        Tooltip.install(labelLastPicture, new Tooltip("上一张"));
        Tooltip.install(labelNextPicture, new Tooltip("下一张"));
        Tooltip.install(labelShearPicture, new Tooltip("剪切"));
        Tooltip.install(labelPastePicture, new Tooltip("粘贴"));
        Tooltip.install(labelRenamePicture, new Tooltip("重命名"));
        Tooltip.install(labelRefreshPicture, new Tooltip("刷新"));
        Tooltip.install(labelSlidePicture, new Tooltip("播放"));
        Tooltip.install(labelExitPicture, new Tooltip("退出程序"));

        //加载操作栏图片
        labelSlidePicture.setGraphic(imageViewSlidePicture);//播放键
        labelLastPicture.setGraphic(imageViewLastPicture);//上一张
        labelNextPicture.setGraphic(imageViewNextPicture);//下一张
        labelShearPicture.setGraphic(imageViewShearPicture);//剪切
        labelCopyPicture.setGraphic(imageViewCopyPicture);//复制
        labelPastePicture.setGraphic(imageViewPastePicture);//粘贴
        labelRefreshPicture.setGraphic(imageViewRefreshPicture);//刷新
        labelDeletePicture.setGraphic(imageViewDeletePicture);//删除
        labelRenamePicture.setGraphic(imageViewRenamePicture);//重命名
        labelAllselectsPicture.setGraphic(imageViewAllselectPicture);//全选
        labelExitPicture.setGraphic(imageViewExitPicture);//退出键
        storer1.getChildren().addAll(labelLastPicture, labelNextPicture, labelRefreshPicture, labelAllselectsPicture);
        storer2.getChildren().addAll(labelSlidePicture, labelShearPicture, labelCopyPicture, labelPastePicture,
                labelRenamePicture, labelDeletePicture, labelExitPicture);

        //设置操纵栏
        controlLowerColumn.setLeft(storer1);
        controlLowerColumn.setRight(storer2);

        //为预览界面的流面板添加入滑动面板
        scrollPane.setFitToHeight(true);
        scrollPane.setFitToWidth(true);
        interfaceUI.setCenter(scrollPane);
        interfaceUI.setBottom(controlLowerColumn);


        //播放监听
        labelSlidePicture.setOnMouseClicked(new EventHandler<MouseEvent>() {
            @Override
            public void handle(MouseEvent mouseEvent) {
                System.out.println("开始播放");
                if (!arrayListImageFile.isEmpty()) {
                    PreviewInterfaceUI.slidePlay();
                }
            }
        });
        //上一张监听
        labelLastPicture.setOnMouseClicked(new EventHandler<MouseEvent>() {
            @Override
            public void handle(MouseEvent event) {
                System.out.println("切换到上一张");
                lastPicture();
            }
        });
        //下一张监听
        labelNextPicture.setOnMouseClicked(new EventHandler<MouseEvent>() {
            @Override
            public void handle(MouseEvent event) {
                System.out.println("切换到下一张");
                nextPicture();
            }
        });
        //刷新监听
        labelRefreshPicture.setOnMouseClicked(new EventHandler<MouseEvent>() {
            @Override
            public void handle(MouseEvent event) {
                System.out.println("刷新");
                try {
                    reFlesh(DirectoryTreeUI.getTempFile());
                } catch (FileNotFoundException e) {
                    e.printStackTrace();
                }
            }
        });
        //全选监听
        labelAllselectsPicture.setOnMouseClicked(new EventHandler<MouseEvent>() {
            @Override
            public void handle(MouseEvent event) {
                System.out.println("触发全选");
                if (arrayListImageFileChoice.size() == arrayListImageFile.size()) {
                    cleanArrayChoices();
                    initFlag();
                    cleanImageStyle();
                    LowerColumnUI.setLabelDataInformationText();
                    setMultipleChoiceEnding(true);
                    return;
                }
                selectAllPicture();
            }
        });
        //剪切监听
        labelShearPicture.setOnMouseClicked(new EventHandler<MouseEvent>() {
            @Override
            public void handle(MouseEvent event) {
                System.out.println("剪切");
                sharePicture();
            }
        });
        //复制监听
        labelCopyPicture.setOnMouseClicked(new EventHandler<MouseEvent>() {
            @Override
            public void handle(MouseEvent event) {
                System.out.println("复制");
                copyPicture();
            }
        });
        //粘贴事件
        labelPastePicture.setOnMouseClicked(new EventHandler<MouseEvent>() {
            @Override
            public void handle(MouseEvent event) {
                System.out.println("粘贴");
                pastePicture();
            }
        });
        //重命名事件
        labelRenamePicture.setOnMouseClicked(new EventHandler<MouseEvent>() {
            @Override
            public void handle(MouseEvent event) {
                System.out.println("重命名");
                renamePicture();
            }
        });
        labelDeletePicture.setOnMouseClicked(new EventHandler<MouseEvent>() {
            @Override
            public void handle(MouseEvent event) {
                System.out.println("删除");
                deletePicture();
            }
        });
        labelExitPicture.setOnMouseClicked(new EventHandler<MouseEvent>() {
            @Override
            public void handle(MouseEvent event) {
                System.out.println("结束程序成功");
                Stage stage = (Stage) labelExitPicture.getScene().getWindow();
                stage.close();
            }
        });


    }

    //分析当前预览视图
    public static void PreInterfaceUI(File file) throws FileNotFoundException {
        preInterfaceClean();
        if (firstTime) {
            firstTime = false;
        } else {
            analysisDirectory(file);
        }
    }

    //初始化当前预览视图的数据
    public static void preInterfaceClean() {
        //初始化设置，包括清空、大小、距离设置
        sizeOfImage = 0;
        setNumOfImage(0);
        setChoicePictureNum(0);
        flowPane.getChildren().clear();
        arrayListImageFile.removeAll(arrayListImageFile);
        arrayListVbox.removeAll(arrayListVbox);
        cleanArrayChoices();
        initFlag();
    }

    // 分析文件目录
    private static void analysisDirectory(File dir) throws FileNotFoundException {
        System.out.println("正在分析文件");
        int i = 0;
        File[] files = dir.listFiles();
        if (files != null) {
            for (File f : files) {
                if (!f.isDirectory()) {
                    if (f.getName().endsWith(".png") || f.getName().endsWith(".jpg") || f.getName().endsWith(".jpeg")
                            || f.getName().endsWith(".gif") || f.getName().endsWith(".bmp") ||
                            f.getName().endsWith(".PNG") || f.getName().endsWith(".JPG") || f.getName().endsWith(".JPEG")
                            || f.getName().endsWith(".GIF") || f.getName().endsWith(".BMP")) {
                        System.out.println(f.getAbsolutePath());
                        //保存图片的提示信息
                        //图片大小
                        double size = f.length() / 1024.0;
                        double tempSize = size;
                        if (tempSize > 1024) {
                            size = size / 1024.0;
                        }
                        String str = String.format("%.2f", size);
                        if (tempSize > 1024) {
                            str = str + " MB";
                        } else {
                            str = str + " KB";
                        }
                        //最后一次的修改时间
                        SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
                        formatter.setTimeZone(TimeZone.getTimeZone("GMT+8:00"));
                        String dateTime = formatter.format(new Date(f.lastModified()));
                        //文件名称以及后缀
                        String fileName = f.getName();
                        String fileExtension = fileName.substring(fileName.indexOf(".") + 1, f.getName().length());
                        //得到最后的图片总提示信息
                        String information = new String("图片名称: " + fileName + "\n" + "图片类型: " + fileExtension + " 图片文件\n" + "大小: " + str + "\n" + "图片最后一次修改时间: " + dateTime + "\n");

                        arrayListImageFile.add(f);
                        setSizeOfImage(getSizeOfImage() + f.length() / 1024.0);
                        setNumOfImage(getNumOfImage() + 1);
                        image = new Image("file:" + f.getAbsolutePath(), 130, 130, true, true, true);
                        labelName = new Label(f.getName());
                        imageView = new ImageView(image);
                        //labelImage = new Label();
                        vBox = new VBox();
                        //限定宽长、像素大小
                        labelName.setWrapText(true);
                        labelName.setPrefWidth(120);
                        imageView.setPreserveRatio(true);
                        //自动换行
                        labelName.setAlignment(Pos.BASELINE_CENTER);
                        //文字居中
                        labelName.setAlignment(Pos.CENTER);
                        vBox.getChildren().addAll(imageView, labelName);
                        //为图片添加提示信息
                        Tooltip.install(imageView, new Tooltip(information));
                        arrayListVbox.add(vBox);
                        flag.add(0);
                        i++;
                        flowPane.getChildren().add(vBox);
                    }
                }
            }
        }
        //图片监听
        imageSetOnAction();
    }


    //鼠标监控
    public static void imageSetOnAction() {
        //清空选中的内容
        //初始化点击标签
        int i = 0;
        initFlag();
        flowPane.setOnMouseClicked(e -> {
            MouseButton eButton = e.getButton();
            if (e.getTarget() instanceof Label) {
                System.out.println("点击了节点");
            } else if (e.getTarget() instanceof Text) {
                System.out.println("点击了文本");
            } else if ((e.getTarget() instanceof FlowPane) && eButton == MouseButton.PRIMARY) {
                //左键点击空白区域，清空选中的图片数据
                System.out.println("点击了空白区域");
                contextMenu.hide();
                initFlag();
                setMultipleChoiceEnding(true);
                cleanArrayChoices();
                setChoicePictureNum(0);
                cleanImageStyle();
                LowerColumnUI.setLabelDataInformationText();
                choosePosition = 0;
            } else if (e.getTarget() instanceof FlowPane && eButton == MouseButton.SECONDARY) {
                //右键空白区域
                rightClickMenuMonitoring(flowPane, e.getScreenX(), e.getScreenY());
            }
        });
        if (!arrayListVbox.isEmpty()) {
            for (VBox t : arrayListVbox) {
                int finalI = i;
                arrayListVbox.get(i).setOnMouseClicked(mouseEvent -> {
                    MouseButton mouseButton = mouseEvent.getButton();
                    choosePosition = finalI;
                    double x, y;
                    x = mouseEvent.getScreenX();
                    y = mouseEvent.getScreenY();
                    if (!isMultipleChoice) {
                        //左键监控,单选模式
                        if (mouseButton == MouseButton.PRIMARY && !isMultipleChoice) {
                            contextMenu.hide();
                            for (int k = 0; k < flag.size(); k++) {
                                if (flag.get(k) == 1 && k != finalI) {
                                    initFlag();
                                }
                                if (flag.get(k) == 2 && k != finalI) {
                                    initFlag();
                                }
                            }
                            if (flag.get(finalI) < 2) {
                                flag.set(finalI, flag.get(finalI) + 1);
                            }
                            setChoicePictureNum(0);
                            for (int k = 0; k < getNumOfImage(); k++) {
                                if (flag.get(k) != 0) {
                                    choicePictureNum++;
                                }
                            }
                            LowerColumnUI.setLabelDataInformationText();
                            //被单击第一下
                            if (flag.get(finalI) == 1) {
                                System.out.println("单击第一次");

                                //点击后重置全部图片的Style颜色
                                cleanImageStyle();

                                //初始化选中的VBox数组和下标数组
                                cleanArrayChoices();

                                intPutPointed(finalI);
                                choiceAdd(finalI);
                                //将点击的图片Style设置为浅蓝色
                                arrayListVbox.get(finalI).setStyle("-fx-background-color: #cef4f8 ;");
                                LowerColumnUI.setLabelDataInformationText();
                            } else if (flag.get(finalI) == 2) {
                                System.out.println("单击第二次");

                                //初始化选中的VBox数组和下标数组
                                cleanArrayChoices();
                                intPutPointed(finalI);
                                choiceAdd(finalI);
                                LowerColumnUI.setLabelDataInformationText();
                                slidePlay();
                            }
                        } else if (mouseButton == mouseButton.SECONDARY) {
                            contextMenu.hide();
                            System.out.println(PreviewInterfaceUI.isMultipleChoiceEnding());
                            //右键单击监控
                            if (!isMultipleChoiceEnding) {
                                System.out.println("多选模式下结束后存好了VBox数组");
                                System.out.println("这是多选结束后的右键单击");
                                //测试展示
                                if (!arrayListPointed.isEmpty()) {
                                    int l = 0;
                                    for (Integer u : arrayListPointed) {
                                        System.out.println("被放入的下标是" + arrayListPointed.get(l));
                                        l++;
                                    }
                                    System.out.println("下标数量:" + arrayListPointed.size());
                                }
                                setChoicePictureNum(arrayListPointed.size());
                                LowerColumnUI.setLabelDataInformationText();
                                contextMenu.show(flowPane, x, y);
                                //////////////////////////////
                                //右键菜单监控
                                rightClickMenuMonitoring(flowPane, x, y);
                            } else if (isMultipleChoiceEnding) {
                                System.out.println("这是右键单击");
                                setChoicePictureNum(0);
                                choicePictureNum++;
                                LowerColumnUI.setLabelDataInformationText();

                                //点击后重置全部图片的Style颜色
                                cleanImageStyle();

                                //初始化选中的VBox数组和下标数组
                                cleanArrayChoices();

                                intPutPointed(finalI);
                                choiceAdd(finalI);
                                arrayListVbox.get(finalI).setStyle("-fx-background-color: #cef4f8 ;");
                                System.out.println("单选模式下存好了VBox数组");
                                //测试展示
                                if (!arrayListPointed.isEmpty()) {
                                    int l = 0;
                                    for (Integer u : arrayListPointed) {
                                        System.out.println("被放入的下标是" + arrayListPointed.get(l));
                                        l++;
                                    }
                                    System.out.println("下标数量:" + arrayListPointed.size());
                                }
                                contextMenu.show(flowPane, x, y);
                                //////////////////////////////
                                //右键菜单监控
                                rightClickMenuMonitoring(flowPane, x, y);
                            }
                        }
                    } else {
                        //多选模式单击
                        if (mouseButton == MouseButton.PRIMARY && isMultipleChoice) {
                            contextMenu.hide();
                            //多选左键单击
                            if (flag.get(finalI) == 0) {
                                flag.set(finalI, flag.get(finalI) + 1);
                                //第一次进来，添加如选中的节点中
                                choiceAdd(finalI);
                                intPutPointed(finalI);
                                setChoicePictureNum(arrayListImageFileChoice.size());
                                LowerColumnUI.setLabelDataInformationText();
                                arrayListVbox.get(finalI).setStyle("-fx-background-color: #cef4f8 ;");
                                choicePictureNum++;
                            } else if (flag.get(finalI) == 1) {
                                arrayListVbox.get(finalI).setStyle(null);
                                //开始取消选中
                                arrayListImageFileChoice.remove(arrayListImageFile.get(finalI));
                                int tempPointed = 0;
                                if (!arrayListPointed.isEmpty()) {
                                    int l = 0;
                                    for (Integer u : arrayListPointed) {
                                        if (arrayListPointed.get(l) == finalI) {
                                            arrayListPointed.remove(arrayListPointed.get(l));
                                            break;
                                        }
                                        l++;
                                    }
                                }
                                flag.set(finalI, 0);
                            }
                        } else if (mouseButton == mouseButton.SECONDARY && isMultipleChoice) {
                            contextMenu.hide();
                            //多选右键单击
                            System.out.println("多选模式下存好了VBox数组");
                            //测试展示
                            if (!arrayListPointed.isEmpty()) {
                                int l = 0;
                                for (Integer u : arrayListPointed) {
                                    System.out.println("被放入的下标是" + arrayListPointed.get(l));
                                    l++;
                                }
                                System.out.println("下标数量:" + arrayListPointed.size());
                            }

                            //////////////////////////////
                            //右键菜单监控
                            rightClickMenuMonitoring(flowPane, x, y);
                        }
                    }
                });
                i++;
            }
        }
    }


    //右键事件监控
    public static void rightClickMenuMonitoring(FlowPane flowPane, double x, double y) {
        if (arrayListImageFile.isEmpty()) {
            menuItems[7].setStyle("-fx-text-fill:gray");
        } else {
            menuItems[7].setStyle("-fx-text-fill:black");
        }
        if (arrayListImageFileChoice.isEmpty()) {
            menuItems[0].setStyle("-fx-text-fill:gray");
            menuItems[2].setStyle("-fx-text-fill:gray");
            menuItems[3].setStyle("-fx-text-fill:gray");
            menuItems[5].setStyle("-fx-text-fill:gray");
            menuItems[6].setStyle("-fx-text-fill:gray");
        } else {
            menuItems[0].setStyle("-fx-text-fill:black");
            menuItems[1].setStyle("-fx-text-fill:black");
            menuItems[2].setStyle("-fx-text-fill:black");
            menuItems[3].setStyle("-fx-text-fill:black");
            menuItems[5].setStyle("-fx-text-fill:black");
            menuItems[6].setStyle("-fx-text-fill:black");
        }
        if (bufferFiles.isEmpty()) {
            menuItems[4].setStyle("-fx-text-fill:gray");
        } else {
            menuItems[4].setStyle("-fx-text-fill:black");
        }
        //////////////////////////////
        //右键菜单监控
        contextMenu.show(flowPane, x, y);
        int ri = 0;
        for (MenuItem r : menuItems) {
            int finalRi = ri;
            menuItems[ri].setOnAction(new EventHandler<ActionEvent>() {
                @Override
                public void handle(ActionEvent actionEvent) {
                    switch (finalRi) {
                        case 0: {
                            System.out.println("打开" + finalRi);
                            if (!arrayListImageFileChoice.isEmpty()) {
                                slidePlay();
                            }
                            break;
                        }
                        case 1: {
                            System.out.println("刷新" + finalRi);
                            try {
                                reFlesh(DirectoryTreeUI.getTempFile());
                            } catch (FileNotFoundException e) {
                                e.printStackTrace();
                            }
                            break;
                        }
                        case 2: {
                            System.out.println("剪切" + finalRi);
                            sharePicture();
                            break;
                        }
                        case 3: {
                            System.out.println("复制" + finalRi);
                            copyPicture();
                            break;
                        }
                        case 4: {
                            System.out.println("粘贴" + finalRi);
                            pastePicture();
                            break;
                        }
                        case 5: {
                            System.out.println("删除" + finalRi);
                            deletePicture();
                            break;

                        }
                        case 6: {
                            System.out.println("重命名" + finalRi);
                            renamePicture();
                            break;
                        }
                        case 7: {
                            System.out.println("全选" + finalRi);
                            cleanImageStyle();
                            LowerColumnUI.setLabelDataInformationText();
                            selectAllPicture();
                            break;
                        }
                    }
                }
            });
            ri++;
        }
    }

    //全选事件
    public static void selectAllPicture() {
        //先初始化
        cleanArrayChoices();
        initFlag();
        if (!arrayListVbox.isEmpty()) {
            //把全部的图片都加入进选中的项内
            arrayListImageFileChoice.addAll(arrayListImageFile);
            //设置全部的flag为1
            for (int i = 0; i < flag.size(); i++) {
                flag.set(i, 1);
            }
            //将全部下标存入数组
            for (int i = 0; i < arrayListVbox.size(); i++) {
                intPutPointed(i);
            }
            //设置全部图片为选中状态
            for (int i = 0; i < arrayListVbox.size(); i++) {
                arrayListVbox.get(i).setStyle("-fx-background-color: #cef4f8;");
            }
            choicePictureNum = arrayListImageFileChoice.size();
        }
        LowerColumnUI.setLabelDataInformationText();
    }

    //剪切事件
    public static void sharePicture() {
        if (arrayListImageFileChoice.isEmpty()) {
            return;
        }
        bufferFiles.clear();
        int length = arrayListImageFileChoice.size();
        for (int i = 0; i < length; i++) {
            File file = arrayListImageFileChoice.get(i);
            rightkey fileRK = new rightkey(file);
            fileRK.toCut(file);
            bufferFiles.add(fileRK);//装入缓冲区
            arrayListVbox.get(arrayListPointed.get(i)).setStyle("-fx-background-color: #f6f1f1");
        }
    }

    //复制事件
    public static void copyPicture() {
        if (arrayListImageFileChoice.isEmpty()) {
            return;
        }
        bufferFiles.clear();
        int length = arrayListImageFileChoice.size();
        for (int i = 0; i < length; i++) {
            File file = arrayListImageFileChoice.get(i);
            rightkey fileRK = new rightkey(file);
            fileRK.toCopy(file);
            bufferFiles.add(fileRK);//装入缓冲区
        }
    }

    //删除事件
    public static void deletePicture() {
        if (arrayListImageFileChoice.isEmpty()) {
            return;
        }
        try {

            Stage stage = new Stage();
            deleteConfirmationPlay(stage);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    //粘贴事件
    public static void pastePicture() {
        int length = bufferFiles.size();
        for (int i = 0; i < length; i++) {
            bufferFiles.get(i).toPaste(DirectoryTreeUI.getTempFile());
        }
        try {
            reFlesh(DirectoryTreeUI.getTempFile());
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }
    }

    //重命名事件
    public static void renamePicture() {
        if (arrayListImageFileChoice.isEmpty()) {
            return;
        }
        listFileNames = DirectoryTreeUI.getTempFile().list();
        lastName = arrayListImageFileChoice.get(0).getName();
        List<File> chosfiles = arrayListImageFileChoice;
        saveAllAffixs();
        try {
            int length = chosfiles.size();
            if (length == 1) {
                renameOne(arrayListImageFileChoice.get(0));
            } else if (length > 1) {
                renameMore();
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    //触发下一张事件
    public static void nextPicture() {
        //先判断图片数量
        if (numOfImage == 0) {
            //一张图片没有则无效
            System.out.println("情况1");
            return;
        }
        if (numOfImage == 1) {
            //只有一张图片则只选这张
            System.out.println("情况1.5");
            int finalI = 0;
            //重置全部图片的Style颜色
            cleanImageStyle();
            //初始化选中的VBox数组和下标数组
            cleanArrayChoices();
            intPutPointed(finalI);
            choiceAdd(finalI);
            //将点击的图片Style设置为浅蓝色
            arrayListVbox.get(finalI).setStyle("-fx-background-color: #cef4f8 ;");
            LowerColumnUI.setLabelDataInformationText();
            return;
        }
        //再判断选中图片的数量
        if (choicePictureNum == 0) {
            //初始一张都没有选中，返回第一张
            System.out.println("情况2");
            //选中第一张
            int finalI = 0;
            //重置全部图片的Style颜色
            cleanImageStyle();
            //初始化选中的VBox数组和下标数组
            cleanArrayChoices();
            intPutPointed(finalI);
            choiceAdd(finalI);
            //将点击的图片Style设置为浅蓝色
            arrayListVbox.get(finalI).setStyle("-fx-background-color: #cef4f8 ;");
            LowerColumnUI.setLabelDataInformationText();
            //设置选中图片的数量为1
            choicePictureNum = 1;
            choosePosition = finalI;

        } else if (choicePictureNum == 1) {
            //正常选中这张的下一张，如果是最后一张，则选中第一张
            System.out.println("情况3");
            int finalI = choosePosition;
            if (finalI == arrayListImageFile.size() - 1) {
                finalI = 0;
            } else {
                finalI = choosePosition + 1;
            }
            cleanImageStyle();
            cleanArrayChoices();
            intPutPointed(finalI);
            choiceAdd(finalI);
            choosePosition = finalI;
            arrayListVbox.get(finalI).setStyle("-fx-background-color: #cef4f8 ;");
            LowerColumnUI.setLabelDataInformationText();
            choicePictureNum = 1;

        } else if (choicePictureNum == numOfImage) {
            System.out.println("情况4");
            //全选情况下选中最后一张
            int finalI = arrayListImageFile.size() - 1;
            cleanImageStyle();
            cleanArrayChoices();
            intPutPointed(finalI);
            choiceAdd(finalI);
            arrayListVbox.get(finalI).setStyle("-fx-background-color: #cef4f8 ;");
            LowerColumnUI.setLabelDataInformationText();
            choicePictureNum = 1;
            choosePosition = finalI;

        } else if (choicePictureNum > 1 && choicePictureNum < numOfImage) {
            //选中数组中的最后一张作为对象，选中对象的下一张
            System.out.println("情况5");
            int finalI = 0;
            //模式一
//            int length = arrayListPointed.size()-1;
//            finalI = arrayListPointed.get(length);
//            if(finalI == arrayListImageFile.size()-1) {
//                finalI = 0;
//            }else {
//                finalI = finalI+1;
//            }
            //模式二
            Iterator<Integer> it = arrayListPointed.iterator();
            while (it.hasNext()) {
                int pos = it.next();
                if (pos >= finalI) {
                    finalI = pos;
                }
            }
            if (finalI == arrayListImageFile.size() - 1) {
                finalI = 0;
            } else {
                finalI = finalI + 1;
            }

            cleanImageStyle();
            cleanArrayChoices();
            intPutPointed(finalI);
            choiceAdd(finalI);
            arrayListVbox.get(finalI).setStyle("-fx-background-color: #cef4f8 ;");
            LowerColumnUI.setLabelDataInformationText();
            choicePictureNum = 1;
            choosePosition = finalI;
        } else if (choicePictureNum > numOfImage) {
            System.out.println("情况6");
            //全选情况下选中最后一张
            int finalI = arrayListImageFile.size() - 1;
            cleanImageStyle();
            cleanArrayChoices();
            intPutPointed(finalI);
            choiceAdd(finalI);
            arrayListVbox.get(finalI).setStyle("-fx-background-color: #cef4f8 ;");
            LowerColumnUI.setLabelDataInformationText();
            choicePictureNum = 1;
            choosePosition = finalI;
        }
    }

    //触发上一张事件
    public static void lastPicture() {
        //先判断图片数量
        if (numOfImage == 0) {
            System.out.println("情况1");
            return;
        }
        if (numOfImage == 1) {
            System.out.println("情况1.5");
            int finalI = 0;
            //重置全部图片的Style颜色
            cleanImageStyle();
            //初始化选中的VBox数组和下标数组
            cleanArrayChoices();
            intPutPointed(finalI);
            choiceAdd(finalI);
            //将点击的图片Style设置为浅蓝色
            arrayListVbox.get(finalI).setStyle("-fx-background-color: #cef4f8 ;");
            LowerColumnUI.setLabelDataInformationText();
            return;
        }
        //再判断选中图片的数量
        if (choicePictureNum == 0) {
            //初始一张都没有选中，返回最后一张
            System.out.println("情况2");
            //选中最后一张
            int finalI = arrayListImageFile.size() - 1;
            //重置全部图片的Style颜色
            cleanImageStyle();
            //初始化选中的VBox数组和下标数组
            cleanArrayChoices();
            intPutPointed(finalI);
            choiceAdd(finalI);
            //将点击的图片Style设置为浅蓝色
            arrayListVbox.get(finalI).setStyle("-fx-background-color: #cef4f8 ;");
            LowerColumnUI.setLabelDataInformationText();
            //设置选中图片的数量为1
            choicePictureNum = 1;
            choosePosition = finalI;

        } else if (choicePictureNum == 1) {
            //正常选中这张的上一张，如果是首张，则选中最后一张
            System.out.println("情况3");
            int finalI = choosePosition;
            if (finalI == 0) {
                finalI = arrayListImageFile.size() - 1;
            } else {
                finalI = choosePosition - 1;
            }
            cleanImageStyle();
            cleanArrayChoices();
            intPutPointed(finalI);
            choiceAdd(finalI);
            choosePosition = finalI;
            arrayListVbox.get(finalI).setStyle("-fx-background-color: #cef4f8 ;");
            LowerColumnUI.setLabelDataInformationText();
            choicePictureNum = 1;

        } else if (choicePictureNum == numOfImage) {
            System.out.println("情况4");
            //全选情况下选中第一张
            int finalI = 0;
            cleanImageStyle();
            cleanArrayChoices();
            intPutPointed(finalI);
            choiceAdd(finalI);
            arrayListVbox.get(finalI).setStyle("-fx-background-color: #cef4f8 ;");
            LowerColumnUI.setLabelDataInformationText();
            choicePictureNum = 1;
            choosePosition = finalI;

        } else if (choicePictureNum > 1 && choicePictureNum < numOfImage) {
            //选中数组中的首张作为对象，选中对象的上一张
            System.out.println("情况5");
            int finalI = arrayListImageFile.size() - 1;
            //模式一
//            finalI = arrayListPointed.get(0);
//            if(finalI == 0) {
//                finalI = arrayListImageFile.size()-1;
//            }else {
//                finalI = finalI-1;
//            }
            //模式二
            Iterator<Integer> it = arrayListPointed.iterator();
            while (it.hasNext()) {
                int pos = it.next();
                if (pos < finalI) {
                    finalI = pos;
                }
            }
            if (finalI == 0) {
                finalI = arrayListImageFile.size() - 1;
            } else {
                finalI = finalI - 1;
            }


            cleanImageStyle();
            cleanArrayChoices();
            intPutPointed(finalI);
            choiceAdd(finalI);
            arrayListVbox.get(finalI).setStyle("-fx-background-color: #cef4f8 ;");
            LowerColumnUI.setLabelDataInformationText();
            choicePictureNum = 1;
            choosePosition = finalI;
        } else if (choicePictureNum > numOfImage) {
            System.out.println("情况6");
            //全选情况下选中第一张
            int finalI = 0;
            cleanImageStyle();
            cleanArrayChoices();
            intPutPointed(finalI);
            choiceAdd(finalI);
            arrayListVbox.get(finalI).setStyle("-fx-background-color: #cef4f8 ;");
            LowerColumnUI.setLabelDataInformationText();
            choicePictureNum = 1;
            choosePosition = finalI;
        }
    }

    //初始化鼠标点击次数标记数组
    public static void initFlag() {
        if (!flag.isEmpty()) {
            for (int k = 0; k < flag.size(); k++) {
                flag.set(k, 0);
            }
        }
    }

    //刷新面板
    public static void reFlesh(File file) throws FileNotFoundException {
        PlayList.isLoad = false;
        PreInterfaceUI(file);
        numOfImage = getNumOfImage();
        TopRoadUI.getLabelPictureNum().setText(" " + numOfImage + " 张图片");
        LowerColumnUI.setLabelDataInformationText();
        choosePosition = 0;
    }

    //将选中的图片的下标传入数组
    public static void intPutPointed(int fi) {
        if (!arrayListPointed.isEmpty()) {
            int i = 0;
            for (Integer t : arrayListPointed) {
                if (arrayListPointed.get(i) == fi) {
                    return;
                }
            }
        }
        arrayListPointed.add(fi);
        return;
    }

    //初始化选中的下标数组、图片文件
    public static void cleanArrayChoices() {
        if (!arrayListPointed.isEmpty()) {
            arrayListPointed.removeAll(arrayListPointed);
        }
        if (!arrayListImageFileChoice.isEmpty()) {
            arrayListImageFileChoice.removeAll(arrayListImageFileChoice);
        }
    }

    //初始化图片的背景
    public static void cleanImageStyle() {
        if (!arrayListVbox.isEmpty()) {
            int j = 0;
            //点击后重置全部图片的Style颜色
            for (j = 0; j < arrayListVbox.size(); j++) {
                arrayListVbox.get(j).setStyle(null);
            }
        }
    }

    //幻灯片播放
    public static void slidePlay() {
        playList.initList(arrayListImageFile, (ArrayList<Integer>) arrayListPointed);
        ViewImageStage x = new ViewImageStage();
        try {
            x.start();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    //将选中的各图片数据传入选中数组
    public static void choiceAdd(int i) {
        arrayListImageFileChoice.add(arrayListImageFile.get(i));
    }

    //重命名步骤
    //获取文件前缀
    public static void saveAllAffixs() {
        int length = arrayListImageFileChoice.size();
        for (int i = 0; i < length; i++) {
            int len = arrayListImageFileChoice.get(i).getName().length();
            int pos = 0;
            while (arrayListImageFileChoice.get(i).getName().charAt(pos) != '.') {
                pos++;
            }
            String fx = "";
            while (pos < len) {
                fx += arrayListImageFileChoice.get(i).getName().charAt(pos);
                pos++;
            }
            fileAffixs.add(fx);

        }

    }

    //重命名单个
    public static void renameOne(File file) {
        AnchorPane ap = new AnchorPane();
        ap.setPrefWidth(300);
        ap.setPrefHeight(80);
        VBox vb = new VBox(10);
        vb.setPrefWidth(300);
        vb.setPrefHeight(90);
        exhibitionLabel.setPrefHeight(20);
        exhibitionLabel.setPrefWidth(300);
        inputNewFileName.setPrefHeight(30);
        inputNewFileName.setPrefWidth(300);
        HBox hb = new HBox(10);
        hb.setPrefSize(300, 20);
        Pane pane = new Pane();
        pane.setPrefSize(150, 20);
        confirmNewFileName.setText("确认");
        confirmNewFileName.setPrefSize(40, 20);
        retype.setText("重写");
        retype.setPrefSize(40, 20);
        exitRename.setText("退出");
        exitRename.setPrefSize(40, 20);
        hb.getChildren().addAll(pane, confirmNewFileName, retype, exitRename);
        vb.getChildren().addAll(exhibitionLabel, inputNewFileName, hb);
        ap.getChildren().addAll(vb);

        String string = "该文件的旧名字为：";
        string += lastName;
        exhibitionLabel.setText(string);
        Scene scene = new Scene(ap);
        Stage stage = new Stage();
        stage.setScene(scene);
        stage.show();

        confirmNewFileName.setOnAction(new EventHandler<ActionEvent>() {
            @Override
            public void handle(ActionEvent event) {
                Stage thisStage = (Stage) confirmNewFileName.getScene().getWindow();
                String newfn = "";
                newfn = inputNewFileName.getText();
                int length = fileAffixs.size();
                if (newfn.equals("")) {
                    exhibitionLabel.setText("错误，输入栏不能为空");
                    return;
                }
                //单选情况下要对比文件名是否存在，多选不需要
                newName = newfn + fileAffixs.get(0);
                int len = listFileNames.length;
                for (int j = 0; j < len; j++) {
                    if (newName.equals(listFileNames[j])) {
                        System.out.println("newName: " + newName);
                        System.out.println("lastName: " + listFileNames[j]);
                        exhibitionLabel.setText("错误，输入的文件名已经存在");
                        return;
                    }
                }
                rightkey rk = new rightkey(file);
                System.out.println("toOne");
                rk.toRenameOne(file, newName);
                try {
                    reFlesh(DirectoryTreeUI.getTempFile());
                } catch (FileNotFoundException e) {
                    e.printStackTrace();
                }
                thisStage.close();
            }
        });

        retype.setOnAction(new EventHandler<ActionEvent>() {
            @Override
            public void handle(ActionEvent event) {
                inputNewFileName.setText("");
                String string = "该文件的旧名字为：";
                string += lastName;
                exhibitionLabel.setText(string);
            }
        });

        exitRename.setOnAction(new EventHandler<ActionEvent>() {
            @Override
            public void handle(ActionEvent event) {
                Stage stage = (Stage) exitRename.getScene().getWindow();
                stage.close();
            }
        });

    }

    //重命名多个
    public static void renameMore() throws Exception {
        AnchorPane ap = new AnchorPane();
        ap.setPrefWidth(400);
        ap.setPrefHeight(80);
        VBox vb = new VBox(10);
        vb.setPrefWidth(400);
        vb.setPrefHeight(90);
        exhibitionLabel.setPrefHeight(20);
        exhibitionLabel.setPrefWidth(400);
        inputNewFileName.setPrefHeight(30);
        inputNewFileName.setPrefWidth(400);
        HBox hb = new HBox(10);
        hb.setPrefSize(200, 20);
        HBox hb1 = new HBox(10);
        Label serial = new Label("起始编号:");
        serial.setPrefSize(60, 20);
//        bianhao.setAlignment(Pos.CENTER_RIGHT);

        inputSerialNumber.setPrefSize(60, 20);
        hb1.getChildren().addAll(serial, inputSerialNumber);
        HBox hb2 = new HBox(10);
        Label digits = new Label("位数");
        digits.setPrefSize(30, 20);
        digits.setAlignment(Pos.CENTER_RIGHT);

        inputDigitsNumber.setPrefSize(50, 20);
        hb2.getChildren().addAll(digits, inputDigitsNumber);
//        Pane pane = new Pane();
//        pane.setPrefSize(150,20);
        confirmNewFileName.setText("确认");
        confirmNewFileName.setPrefSize(40, 20);
        retype.setText("重写");
        retype.setPrefSize(40, 20);
        exitRename.setText("退出");
        exitRename.setPrefSize(40, 20);
        hb.getChildren().addAll(hb1, hb2, confirmNewFileName, retype, exitRename);
        vb.getChildren().addAll(exhibitionLabel, inputNewFileName, hb);
        ap.getChildren().addAll(vb);

        String string = "该文件的旧名字为：";
        string += lastName;
        exhibitionLabel.setText(string);
        Scene scene = new Scene(ap);
        Stage stage = new Stage();
        stage.setScene(scene);
        stage.show();

        confirmNewFileName.setOnAction(new EventHandler<ActionEvent>() {
            @Override
            public void handle(ActionEvent event) {
                Stage thisStage = (Stage) confirmNewFileName.getScene().getWindow();
                String newFileName = "";
                String serial = "";
                String digits = "";
                newFileName = inputNewFileName.getText();
                serial = inputSerialNumber.getText();
                digits = inputDigitsNumber.getText();
                if (newFileName.equals("") || serial.equals("") || digits.equals("")) {
                    exhibitionLabel.setText("错误，输入栏不能为空");
                    return;
                }
                int serialNumber;//起始编号
                if (serial.length() == 1) {
                    serialNumber = serial.charAt(0) - '0';
                } else {
                    serialNumber = Integer.parseInt(serial);
                }
                int digitsNumber;//位数
                if (serial.length() == 1) {
                    digitsNumber = digits.charAt(0) - '0';
                } else {
                    digitsNumber = Integer.parseInt(digits);
                }
                if (serial.length() > digitsNumber) {
                    exhibitionLabel.setText("错误，输入的编号长度大于你输入的位数");
                    return;
                }
                rightkey rk = new rightkey();
                rk.toRenameMore(arrayListImageFileChoice, newFileName, fileAffixs, serialNumber, digitsNumber);
                try {
                    reFlesh(DirectoryTreeUI.getTempFile());
                } catch (FileNotFoundException e) {
                    e.printStackTrace();
                }
                thisStage.close();
            }
        });

        retype.setOnAction(new EventHandler<ActionEvent>() {
            @Override
            public void handle(ActionEvent event) {
                inputNewFileName.setText("");
                inputSerialNumber.setText("");
                inputDigitsNumber.setText("");
                String string = "该文件的旧名字为：";
                string += lastName;
                exhibitionLabel.setText(string);
            }
        });

        exitRename.setOnAction(new EventHandler<ActionEvent>() {
            @Override
            public void handle(ActionEvent event) {
                Stage stage = (Stage) exitRename.getScene().getWindow();
                stage.close();
            }
        });

    }

    //右键删除确认框
    public static void deleteConfirmationPlay(Stage primaryStage) throws Exception {
        StackPane ap = new StackPane();
        VBox vBox = new VBox(20);
        HBox hBox = new HBox(10);
        Label label = new Label("是否选择删除");
        confirmDelete.setText("确定");
        confirmDelete.setPrefSize(60, 20);
        cancelDelete.setText("取消");
        cancelDelete.setPrefSize(60, 20);
        label.setPrefWidth(130);
        label.setStyle("-fx-font: 20 arial;-fx-text-fill:red");
        confirmDelete.setStyle("-fx-font: 18 arial;-fx-text-fill:pink");
        cancelDelete.setStyle("-fx-font: 18 arial;-fx-text-fill:red");
        label.setAlignment(Pos.CENTER);
        hBox.getChildren().addAll(confirmDelete, cancelDelete);
        vBox.getChildren().addAll(label, hBox);
        ap.getChildren().add(vBox);
        Scene scene = new Scene(ap);
        primaryStage.setScene(scene);
        primaryStage.show();


        confirmDelete.setOnAction(new EventHandler<ActionEvent>() {
            @Override
            public void handle(ActionEvent event) {
                int length = arrayListImageFileChoice.size();
                for (int i = 0; i < length; i++) {
                    File file = arrayListImageFileChoice.get(i);
//                    rightkey fileRK = new rightkey(file);
//                    fileRK.todelete(file);
                    file.delete();
                }
                //每个文件都删除后刷新
                try {
                    reFlesh(DirectoryTreeUI.getTempFile());
                    setMultipleChoiceEnding(true);
                } catch (FileNotFoundException e) {
                    e.printStackTrace();
                }
                Stage stage = (Stage) confirmDelete.getScene().getWindow();
                stage.close();
            }
        });

        cancelDelete.setOnAction(new EventHandler<ActionEvent>() {
            @Override
            public void handle(ActionEvent event) {
                Stage stage = (Stage) cancelDelete.getScene().getWindow();
                stage.close();
            }
        });
    }

    public static int getNumOfImage() {
        return numOfImage;
    }

    public static void setNumOfImage(int imageCount) {
        PreviewInterfaceUI.numOfImage = imageCount;
    }

    public List<VBox> getArrayListVbox() {
        return arrayListVbox;
    }

    public static int getChoicePictureNum() {
        return choicePictureNum;
    }

    public static void setChoicePictureNum(int choicePictureNum) {
        PreviewInterfaceUI.choicePictureNum = choicePictureNum;
    }

    public static boolean isMultipleChoice() {
        return isMultipleChoice;
    }

    public static void setMultipleChoice(boolean multipleChoice) {
        isMultipleChoice = multipleChoice;
    }

    public static boolean isMultipleChoiceEnding() {
        return isMultipleChoiceEnding;
    }

    public static void setMultipleChoiceEnding(boolean multipleChoiceEnding) {
        isMultipleChoiceEnding = multipleChoiceEnding;
    }

    public static double getSizeOfImage() {
        return sizeOfImage;
    }

    public static void setSizeOfImage(double sizeOfImage) {
        PreviewInterfaceUI.sizeOfImage = sizeOfImage;
    }

    public ScrollPane getScrollPane() {
        return scrollPane;
    }

    public void setScrollPane(ScrollPane scrollPane) {
        this.scrollPane = scrollPane;
    }

    public static BorderPane getInterfaceUI() {
        return interfaceUI;
    }

    public static void setInterfaceUI(BorderPane interfaceUI) {
        PreviewInterfaceUI.interfaceUI = interfaceUI;
    }

    public static FlowPane getFlowPane() {
        return flowPane;
    }

    public static void setFlowPane(FlowPane flowPane) {
        PreviewInterfaceUI.flowPane = flowPane;
    }

    public static List<File> getArrayListImageFileChoice() {
        return arrayListImageFileChoice;
    }

    public static void setArrayListImageFileChoice(List<File> arrayListImageFileChoice) {
        PreviewInterfaceUI.arrayListImageFileChoice = arrayListImageFileChoice;
    }
}